#include <stdio.h>

int main(int argc, char const *argv[])
{
    int x = 0;
    int *p = &x;
    int &ref1 = x;
    int *const cp = &x;
    x = 5;

    printf("*p=%d, sizeof(p)=%d\n", *p, sizeof(p)); // 5 8

    /* 结论：引用就是指针常量 */
    printf("ref1=%d, sizeof(ref1)=%d\n", ref1, sizeof(ref1)); // 5 4
    printf("cp=%d, sizeof(*cp)=%d\n", *cp, sizeof(*cp));      // 5 4

    ref1++;
    (*cp)++;
    // *cp++; // ++ 优先级高于 *
    printf("ref1=%d,x=%d\n", ref1, x); // 6 6
    printf(" *cp=%d,x=%d\n", *cp, x);  // 6 6

    /* 引用不能为空，指针可以为空。*/
    // int &q2;
    int *p2;

    return 0;
}
